package com.sm.graduation.apply.service;

import com.sm.graduation.apply.dao.ApplyFoodMapper;
import com.sm.graduation.apply.pojo.ApplyFood;
import com.sm.graduation.food.pojo.MonthlyCatering;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 2022/3/11  14:11
 */
@Service
public class ApplyFoodService {
    @Autowired
    private ApplyFoodMapper applyFoodMapper;
   //增加申请
    public int insert(ApplyFood applyFood){
        System.out.println("增加饮食服务成功");
      return applyFoodMapper.addApplyFood(applyFood);
    }
//查询所有已申请的餐饮业务
    public List<ApplyFood> selectApplyFoodAll1(){
        System.out.println("查询出的表"+applyFoodMapper.selectApplyFoodAll());
        return  applyFoodMapper.selectApplyFoodAll();
    }
    //查询所有已申请的医疗业务
    public List<ApplyFood> selectApplyMedicationAll1(){
        return  applyFoodMapper.selectApplyMedicationAll();
    }
    //根据申请人名称查询
    public List<ApplyFood> selectApplyMedicationAll2(String user){
        return  applyFoodMapper.selectApplyMedicationbyuser(user);
    }
    //根据申请人名称查询
    public List<ApplyFood> selectApplyFoodAll2(String user){
        return  applyFoodMapper.selectApplyFoodbyuser(user);
    }
    //根据id修改申请的状态
    public int updateStatus(int id ,String status){
        return applyFoodMapper.updateStatus(id,status);
    }
    //超级管理员查看管理所有申请
    public List<ApplyFood> selectApply(){
        return applyFoodMapper.selectApply();
    }
    //root根据申请人查询申请
    public List<ApplyFood> selectApplyFoodbyuser1(String user){
        return applyFoodMapper.selectApplyFoodbyuser1(user);
   }
    //根据id删除申请
    public int delApplyByid(int id){
        return applyFoodMapper.delApplyByid(id);
   }
    //根据用户id查询用户申请的全部服务
    public List<ApplyFood> selectmyApply(int uid){
       return applyFoodMapper.selectmyApply(uid);
    };
    //根据用户id查询用户申请的全部服务
    public  List<ApplyFood> selectmyApplyname( int uid, String proname){
        return applyFoodMapper.selectmyApplyname(uid,proname);
    };
    //评论
    public int updateApplyConment(int id,String conment){
        return applyFoodMapper.updateApplyConment(id,conment);
    }

}
